<!--

    Copyright (C) 2015 The Gravitee team (http://gravitee.io)

    Licensed under the Apache License, Version 2.0 (the "License");
    you may not use this file except in compliance with the License.
    You may obtain a copy of the License at

            http://www.apache.org/licenses/LICENSE-2.0

    Unless required by applicable law or agreed to in writing, software
    distributed under the License is distributed on an "AS IS" BASIS,
    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    See the License for the specific language governing permissions and
    limitations under the License.

-->
<div>
    <div fxFlex="70">
      <div fxLayout="row" *ngIf="!isEmpty">
        <div fxFlex>You have configured <b>{{credentials.length}}</b> WebAuthn credentials.</div>
      </div>
      <ngx-datatable *ngIf="!isEmpty" class="material"
                     [columnMode]="'flex'"
                     [headerHeight]="40"
                     [footerHeight]="40"
                     [rowHeight]="50"
                     [rows]='credentials'>
        <ngx-datatable-column name="Credentials" [flexGrow]="4" [cellClass]="'factor-name-cell'">
          <ng-template let-row="row" ngx-datatable-cell-template>
            <div class="factor-header" fxLayout="row">
              <div class="factor-icon">
                <mat-icon>fingerprint</mat-icon>
              </div>
              <div class="factor-information" fxLayout="column">
                <h3><span *ngIf="row.attestationStatementFormat">{{row.attestationStatementFormat}} | </span>{{row.credentialId}}</h3>
                <small>{{row.publicKey}}</small>
              </div>
            </div>
          </ng-template>
        </ngx-datatable-column>
        <ngx-datatable-column [flexGrow]="1">
          <ng-template let-row="row" ngx-datatable-cell-template>
            <div fxLayout="row" class="gv-table-cell-actions">
              <a mat-icon-button [routerLink]="[row.id]"><mat-icon matTooltip="More info">more_horiz</mat-icon></a>
              <button *ngIf="canRevoke" mat-icon-button (click)="remove($event, row)"><mat-icon style="color: #f44336;" matTooltip="Remove credential">highlight_off</mat-icon></button>
            </div>
          </ng-template>
        </ngx-datatable-column>
      </ngx-datatable>

      <app-emptystate *ngIf="isEmpty"
                      [message]="'No credentials'"
                      [subMessage]="'No data to display.'"
                      [icon]="'donut_large'"></app-emptystate>
    </div>
    <div class="gv-page-description" fxFlex>
      <h3>WebAuthn Credentials</h3>
      <div class="gv-page-description-content">
        <p>
          WebAuthn credentials are set of private-public keypair use to verify the identity of a user whenever required.
        </p>
      </div>
    </div>
</div>

